using System;
using System.Drawing;
using System.Windows.Forms;
using roster.Domain;
using System.Collections.Generic;

namespace roster.UI
{
	public partial class RaidCreationView : Form
	{
		public event MethodInvoker RaidCreated;
		public event Action<string> PlayerSelected;
		public event Action<string> PlayerUnselected;
		
		private static Color m_PlayerNotOnRosterColor = Color.Yellow;
		
		public RaidCreationView()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
		}
		
		public void AddPlayer(IPlayer player, bool isOnRoster)
		{
			m_raidCheckedListBox.Items.Add(player.Name, isOnRoster);
		}
		
		void m_createRaidBtnClick(object sender, EventArgs e)
		{
			RaidCreated();
		}
		
		void m_raidCheckedListBox_ItemChecked(object sender, ItemCheckEventArgs e)
		{
			if (e.NewValue == CheckState.Checked)
				PlayerSelected(m_raidCheckedListBox.GetItemText(m_raidCheckedListBox.Items[e.Index]));
			else
				PlayerUnselected(m_raidCheckedListBox.GetItemText(m_raidCheckedListBox.Items[e.Index]));
		}
	}
}
